﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Blazing.WebFacade;
using Blazing.WebFacade.Extensions;
using Blazing.WebShop.Classes;
using Blazing.BusinessObjects.Cms;
using Blazing.BusinessObjects.Products;

namespace Blazing.WebShop.UserControls
{
    public partial class AddToCart : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void LinkButtonAddToCart_Click(object sender, EventArgs e)
        {
            var controller = new ProductsController();
            Contentpage page = ((SiteBasePage)Page)._page;

            if (page != null)
            {
                Product prod = controller.GetProductFromPage(page);
                if (prod != null)
                {
                    controller.AddProductToCart(prod);
                }
            }
        }
    }
}